<template>
  <div>
    <el-dialog title="应急知识文档详情" :visible.sync="open" width="80%" append-to-body>
      <el-form ref="form" :model="form" label-width="120px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="知识库分类" prop="doctitle">
              {{ form.categoryName }}
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="文档标题" prop="doctitle">
              {{ form.doctitle }}
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="主题词" prop="dockeyword">
              {{ form.dockeyword }}
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="文档类型" prop="doctypecode">
              <dict-tag :options="dict.type.doctypecode_dict" :value="form.doctypecode" />
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="发文日期" prop="issuedate">
              {{ form.issuedate }}
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="编制单位" prop="issueorg">
              {{ form.issueorg }}
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="签发人" prop="signper">
              {{ form.signper }}
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="密级代码" prop="classcode">
              <dict-tag :options="dict.type.classcode_dict" :value="form.classcode" />
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="紧急程度" prop="urgencycode">
              <dict-tag :options="dict.type.urgencycode_dict" :value="form.urgencycode" />
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="文档来源" prop="docsource">
              {{ form.docsource }}
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="关键词" prop="keyWord">
              {{ form.keyWord }}
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="备注" prop="notes">
              {{ form.notes }}
            </el-form-item>
          </el-col>
        </el-row>

        <!-- 上传 -->
        <el-row>
          <el-col :span="24">
            <el-form-item label="附件">
              <el-table :data="form.attachs" max-height="250" size="mini">
                <el-table-column prop="attachname" label="名称">
                </el-table-column>
                <el-table-column prop="attachsize" label="大小">
                </el-table-column>
                <el-table-column prop="attachtype" label="类型">
                </el-table-column>
                <el-table-column label="操作">
                  <template slot-scope="scope">
                    <el-button type="text" size="small" @click="downloadFile(scope.row)">
                      下载
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="close">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { getDoc } from "@/api/kno/doc";
import dialogMixin from '@/mixins/dialogMixin'
export default {
  name: 'DocDetailDialog',
  mixins: [dialogMixin],
  dicts: ["doctypecode_dict", "urgencycode_dict", "classcode_dict"],
  data() {
    return {
      form: {},
    }
  },
  methods: {
    show(id) {
      getDoc(id).then(res => {
        this.form = res.data
      })
      this.open = true;
    }
  },
}
</script>

<style></style>